package com.tao.admin.controller;

import com.tao.admin.service.CategoryService;
import com.tao.param.PageParam;
import com.tao.pojo.Category;
import com.tao.utils.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 86130
 * 类别控制器
 */
@RestController
@RequestMapping("category")
public class CategoryController {

    @Resource
    private CategoryService categoryService;

    @GetMapping("list")
    public R pageList(PageParam pageParam) {
        return categoryService.pageList(pageParam);
    }

    @PostMapping("save")
    public R adminSave(Category category) {
        return categoryService.adminSave(category);
    }

    @PostMapping("remove")
    public R adminRemove(Integer categoryId) {
        return categoryService.adminRemove(categoryId);
    }

    @PostMapping("update")
    public R adminUpdate(Category category) {
        return categoryService.adminUpdate(category);
    }

}
